package com.mrd.gtimp.service.config;

import com.mrd.gtimp.service.impl.CtmsServiceImpl;
import com.mrd.gtimp.service.impl.DataInitServiceImpl;
import com.mrd.gtimp.service.impl.DeclarationBizServiceImpl;
import com.mrd.gtimp.service.impl.HelloServiceImpl;
import com.mrd.gtimp.service.impl.TaxBizServiceImpl;

import org.apache.cxf.Bus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;
import javax.xml.ws.Endpoint;

/**
 * Created by winaya on 2016/11/2.
 */
@Configuration
public class CxfConfig {
    @Resource
    private Bus bus;

    @Bean
    public Endpoint helloServiceEndpoint() {
        EndpointImpl endpoint = new EndpointImpl(bus, new HelloServiceImpl());
        endpoint.publish("/helloService");
        return endpoint;
    }

    @Bean
    public Endpoint dataInitServiceEndpoint() {
        EndpointImpl endpoint = new EndpointImpl(bus, new DataInitServiceImpl());
        endpoint.publish("/dataInitService");
        return endpoint;
    }

    @Bean
    public Endpoint declarationBizServiceEndpoint() {
        EndpointImpl endpoint = new EndpointImpl(bus, new DeclarationBizServiceImpl());
        endpoint.publish("/declarationBizService");
        return endpoint;
    }

    @Bean
    public Endpoint taxBizServiceEndpoint() {
        EndpointImpl endpoint = new EndpointImpl(bus, new TaxBizServiceImpl());
        endpoint.publish("/taxBizService");
        return endpoint;
    }

    @Bean
    public Endpoint ctmsServiceEndpoint() {
        EndpointImpl endpoint = new EndpointImpl(bus, new CtmsServiceImpl());
        endpoint.publish("/ctmsService");
        return endpoint;
    }
}
